<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>系统登录</title>
    <link href="__PUBLIC__/backstage/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="__PUBLIC__/css/login.css" />
</head>
<body>



<div class="main">
    <img src="__PUBLIC__/image/login.jpg" >

    <div class="forms">

        <iframe frameborder=0
                width=275 height=120
                marginheight=0 marginwidth=0
                scrolling=no src=__CONTROLLER__/hot.html>

        </iframe>

        <form action="#" method="post">
            <table class="login">
                <tr><th>用户名：</th><td><input type="text" name="loginname" /></td></tr>
                <tr><th>密 &nbsp码：</th><td><input type="password" name="password" /></td></tr>
<!--                <tr><th>验证码：</th><td><input  id="captcha" name="captcha" type="text" /></td></tr>
                <tr><th></th><td class="captcha"> <img src="__CONTROLLER__/verifyImg" onclick="this.src='__CONTROLLER__/verifyImg/'+Math.random()" alt="" /></td></tr>
    -->            <tr><th></th><td><input type="submit" value="登录" id="btn_login" /></td></tr>
            </table>
        </form>


    </div>
</div>
<!-- 通过JavaScript实现单击更换验证码 -->
<script src="__PUBLIC__/backstage/assert/jquery-1.9.1.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="__PUBLIC__/backstage/assert/bootstrap.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/backstage/js/jquery.cookie.js"></script>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<script src="__PUBLIC__/backstage/js/jquery.base64.js"></script>

<script>
    /*      var captcha = document.getElementById("captcha");
     var change = document.getElementById("change");
     change.onclick = function(){
     captcha.src = "./code.php?rand=" + Math.random(); //增加一个随机参数，防止图片缓存
     return false; //阻止超链接动作
     };*/

/*    $("#loginForm").ajaxForm(function(data){
        //登录失败，刷新验证码
        data.ok || $("#captcha").click();
    });*/


 $("#btn_login").click(function (e) {
 save();
 //不知道点击后触发了啥事件，用下面这个函数将其覆盖了
 e.preventDefault();
 　　$.ajax({
 　　type:'post',//可选get
 　　url: "{:U('Login/doLogin')}",//这里是接收数据的PHP程序
 　　data:'username=' + $('#username').val() + '&password=' + $('#password').val(),//传给PHP的数据，多个参数用&连接
 　　dataType:'json',//服务器返回的数据类型 可选XML ,Json jsonp script html text等
 　　success:function (data) {
 //                console.log(data);
 　　//这里是ajax提交成功后，PHP程序返回的数据处理函数。msg是返回的数据，数据类型在dataType参数里定义!
 if (data.status == 0) {
 $('#tip').text(data.content);
 if(data.ismobile==1){
 $('#form-signin').attr('action',"{:U('Feedback/index')}");
 }
 if(data.is_distributor == 1){
 $('#form-signin').attr('action',"{:U('Feedback/index')}");
 }
 else{
 $('#form-signin').attr('action',"{:U('Feedback/index')}");
 }
 $('#form-signin').submit();
 }
 $('#tip').text(data.content);
 }
 ,
 　　error:function (data) {
 　　//ajax提交失败的处理函数!
 $('#tip').text('网络出现错误，请稍后再试！');
 }
 });
 });
</script>
</body>
</html>